{% extends '@WebsiteBundle/layout/baselayout.html.twig' %}
{% import "@WebsiteBundle/macros/pagination.html.twig" as macros %}
{% block seo_title %}
	{{ seoTitle }}
{% endblock %}
{% block seo_descr %}
	{{ seoDescr }}
{% endblock %}
{% block seo_kw %}
	{{ seoKw }}
{% endblock %}
{% block body_main %}
	{{ parent() }}
	<div class="page">
		{{ render(path('app_header', {"route":route})) }}
		<div class="navbar-expand-md">
			<div class="navbar navbar-light">
				<div class="container-xl">
					<ul class="nav nav-pills">
						<li class="nav-item">
							<a class="nav-link {% if categoryId==0 %} active {% endif %}" href="{{ path('app_course') }}">全部</a>
						</li>
						{% if brands %}
							{% for item in brands %}
								<li class="nav-item">
									<a class="nav-link {% if categoryId==item['id'] %} active {% endif %}" href="{{ path('app_course', {'categoryId':item['id']}) }}">{{ item['name'] }}</a>
								</li>
							{% endfor %}
						{% endif %}
					</ul>
				</div>
			</div>
		</div>
		<div class="page-wrapper">
			<div class="page-body">
				<div class="container-xl">
					<div class="row row-deck row-cards">
						<div class="col-sm-12 col-lg-12">
							<div class="card">
								<div class="card-body">
									<ul class="nav nav-bordered mb-4">
										<li class="nav-item">
											<a class="nav-link {% if isFree==2 %} active {% endif %}" href="{{ path('app_course', {'categoryId':categoryId,'isFree':2}) }}">全部</a>
										</li>
										<li class="nav-item">
											<a class="nav-link {% if isFree==1 %} active {% endif %}" href="{{ path('app_course', {'categoryId':categoryId,'isFree':1}) }}">免费</a>
										</li>
										<li class="nav-item">
											<a class="nav-link {% if isFree==0 %} active {% endif %}" href="{{ path('app_course', {'categoryId':categoryId,'isFree':0}) }}">收费</a>
										</li>
									</ul>
									<div class="row row-deck row-cards">
										{% if list %}
											{% for item in list %}
												<div class="col-sm-12 col-lg-4">
													<div class="card">
														<div class="img-responsive img-responsive-21x9 card-img-top" style="background-image: url({{ json_get(item['goodsSmallImg']) }})"></div>
														<div class="card-body">
															<h3 class="card-title">
																<a href="{{ path('app_course_detail', {'id':item['id']}) }}" class="stretched-link text-truncate" >{{ item['name'] }}</a>
															</h3>
															{% if item['tagsArr'] %}
																<div class="text-muted">
																	{% for item in item['tagsArr'] %}
																		<span class="status status-azure">{{ item }}</span>
																	{% endfor %}
																</div>
															{% endif %}
														</div>
														<div class="card-body">
															<div class="hstack">
																<div class="p-2">{{ item['courseCount'] }}次课共{{ item['courseHour'] }}小时</div>
																<div class="p-2 ms-auto">{{ item['buyNumberView'] }}人报名</div>
																<div class="p-2 ms-auto">
																	{% if item['shopPrice'] >0 %}
																		<span class="badge bg-red">¥{{ item['shopPriceView'] }}</span>
																	{% else %}
																		<span class="badge bg-teal">免费</span>
																	{% endif %}
																</div>
															</div>
														</div>
													</div>
												</div>
											{% endfor %}
											<div class="col-sm-12 col-lg-12 pagination ">
												{{ macros.pagination(pagination) }}
											</div>
										{% else %}
											{% include '@WebsiteBundle/empty.html.twig' %}
										{% endif %}
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		{{ render(path('app_footer')) }}
	</div>
{% endblock %}
